package com.naire.modul.cusorg.service;

import net.common.manager.SystemCodeManager;
import net.common.service.GeneralService;

import com.naire.modul.cusorg.dao.CusorgDao;
import com.naire.modul.cusorg.dao.impl.CusorgDaoImpl;
import com.naire.modul.cusorg.vo.CusorgVo;

/**
 * 
 * 
 * @author Administrator
 * 
 */
public class CusorgEditorService extends GeneralService {

	private CusorgVo bean;
	private String parent_code;
	private String dict_num;

	@Override
	public void execute() throws Exception {
		CusorgDao dao = new CusorgDaoImpl();
		if (bean.getOrg_id() != null) {
			dao.update(bean);
		} else {
			if(parent_code != null && !parent_code.equals("")) {				
				bean.setParent_num(parent_code);
			}
			bean.setIndustry(dict_num);
			bean.setOrg_num(SystemCodeManager.createCode("0002", parent_code));
			bean.setFlag(0);
			dao.insert(bean);
		}
	}

	public void setBean(CusorgVo bean) {
		this.bean = bean;
	}

	public void setParent_code(String parent_code) {
		this.parent_code = parent_code;
	}

	public void setDict_num(String dict_num) {
		this.dict_num = dict_num;
	}

}
